package com.sunyard.pcc.core.manager.impl;

import com.sunyard.michiru.common.entity.PageResult;
import com.sunyard.pcc.dal.model.SysLogDO;
import com.sunyard.pcc.dal.query.SysLogQuery;
import com.sunyard.pcc.dal.mapper.ext.SysLogExtMapper;
import com.sunyard.pcc.core.manager.SysLogManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Manager for SysLog.
 */
@Component
public class SysLogManagerImpl implements SysLogManager{

    
    @Autowired
    protected SysLogExtMapper sysLogExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(SysLogQuery query){
        return sysLogExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(SysLogQuery query){
        return sysLogExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(SysLogDO record){
        return sysLogExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(SysLogDO record){
        return sysLogExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<SysLogDO> selectByQuery(SysLogQuery query){
        return sysLogExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<SysLogDO> selectByQueryWithPage(SysLogQuery query) {
        PageResult<SysLogDO> result = new PageResult<SysLogDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public SysLogDO selectByPrimaryKey(Long id){
        return sysLogExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( SysLogDO record,  SysLogQuery query){
        return sysLogExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( SysLogDO record,  SysLogQuery query){

        return sysLogExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(SysLogDO record){
        return sysLogExtMapper.updateByPrimaryKeySelective(record);
    }

}